/*     */ package com.lmpop.trade.ti_discountpolicy;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_discountpolicyInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_discountpolicyInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     Ti_discountpolicy ti_discountpolicy = new Ti_discountpolicy();
/*  26 */     ti_discountpolicy.setDiscount_id(map.getString("discount_id"));
/*  27 */     ti_discountpolicy.setMember_level(map.getInt("member_level"));
/*  28 */     ti_discountpolicy.setOffer_type(map.getString("offer_type"));
/*  29 */     ti_discountpolicy.setNumber(map.getInt("number"));
/*  30 */     ti_discountpolicy.setDiscount(map.getInt("discount"));
/*  31 */     if ((map.getString("ship_offer") == null) || ("".equals(map.getString("ship_offer"))))
/*  32 */       ti_discountpolicy.setShip_offer("0.00");
/*     */     else
/*  34 */       ti_discountpolicy.setShip_offer(map.getString("ship_offer"));
/*  35 */     if ((map.getString("spending") == null) || ("".equals(map.getString("spending"))))
/*  36 */       ti_discountpolicy.setSpending("0.00");
/*     */     else
/*  38 */       ti_discountpolicy.setSpending(map.getString("spending"));
/*  39 */     ti_discountpolicy.setVoucher_type(map.getString("voucher_type"));
/*  40 */     ti_discountpolicy.setVoucher_num(map.getInt("voucher_num"));
/*  41 */     ti_discountpolicy.setSend_a_few(map.getInt("send_a_few"));
/*  42 */     ti_discountpolicy.setGift_ids(map.getString("gift_ids"));
/*  43 */     ti_discountpolicy.setOrder_amount(map.getString("order_amount"));
/*  44 */     ti_discountpolicy.setGood_offer(map.getString("good_offer"));
/*  45 */     ti_discountpolicy.setStart_time(map.getString("start_time"));
/*  46 */     ti_discountpolicy.setEnd_time(map.getString("end_time"));
/*  47 */     ti_discountpolicy.setUser_id(map.getString("user_id"));
/*  48 */     ti_discountpolicy.setClass_attr(map.getString("class_attr"));
/*  49 */     String result_code = "0";
/*     */     try {
/*  51 */       insert(dbmMgr, ti_discountpolicy);
/*     */     } catch (ApplicationException e) {
/*  53 */       e.printStackTrace();
/*  54 */       result_code = "1";
/*     */     }
/*  56 */     map.setString("result_code", result_code);
/*  57 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_discountpolicy ti_discountpolicy)
/*     */     throws ApplicationException
/*     */   {
/*  66 */     dbmMgr.update("insertTi_discountpolicy", ti_discountpolicy);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  76 */     String discount_id = map.getString("discount_id");
/*  77 */     String offer_type = map.getString("offer_type");
/*     */ 
/*  79 */     Ti_discountpolicy ti_discountpolicy = new Ti_discountpolicy();
/*  80 */     ti_discountpolicy.setDiscount_id(discount_id);
/*  81 */     ti_discountpolicy.setOffer_type(offer_type);
/*  82 */     String result_code = "0";
/*     */     try
/*     */     {
/*  85 */       delete(dbmMgr, ti_discountpolicy);
/*     */     }
/*     */     catch (ApplicationException e) {
/*  88 */       e.printStackTrace();
/*  89 */       result_code = "1";
/*     */     }
/*  91 */     map.setString("result_code", result_code);
/*  92 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, Ti_discountpolicy ti_discountpolicy)
/*     */     throws ApplicationException
/*     */   {
/* 101 */     dbmMgr.update("deleteTi_discountpolicy", ti_discountpolicy);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 110 */     Ti_discountpolicy ti_discountpolicy = new Ti_discountpolicy();
/* 111 */     ti_discountpolicy.setDiscount_id(map.getString("discount_id"));
/* 112 */     ti_discountpolicy.setMember_level(map.getInt("member_level"));
/* 113 */     ti_discountpolicy.setOffer_type(map.getString("offer_type"));
/* 114 */     ti_discountpolicy.setNumber(map.getInt("number"));
/* 115 */     ti_discountpolicy.setDiscount(map.getInt("discount"));
/* 116 */     if ((map.getString("ship_offer") == null) || ("".equals(map.getString("ship_offer"))))
/* 117 */       ti_discountpolicy.setShip_offer("0.00");
/*     */     else
/* 119 */       ti_discountpolicy.setShip_offer(map.getString("ship_offer"));
/* 120 */     if ((map.getString("spending") == null) || ("".equals(map.getString("spending"))))
/* 121 */       ti_discountpolicy.setSpending("0.00");
/*     */     else
/* 123 */       ti_discountpolicy.setSpending(map.getString("spending"));
/* 124 */     ti_discountpolicy.setVoucher_type(map.getString("voucher_type"));
/* 125 */     ti_discountpolicy.setVoucher_num(map.getInt("voucher_num"));
/* 126 */     ti_discountpolicy.setSend_a_few(map.getInt("send_a_few"));
/* 127 */     ti_discountpolicy.setGift_ids(map.getString("gift_ids"));
/* 128 */     ti_discountpolicy.setOrder_amount(map.getString("order_amount"));
/* 129 */     ti_discountpolicy.setGood_offer(map.getString("good_offer"));
/* 130 */     ti_discountpolicy.setStart_time(map.getString("start_time"));
/* 131 */     ti_discountpolicy.setEnd_time(map.getString("end_time"));
/* 132 */     ti_discountpolicy.setUser_id(map.getString("user_id"));
/* 133 */     ti_discountpolicy.setClass_attr(map.getString("class_attr"));
/* 134 */     String result_code = "0";
/*     */     try {
/* 136 */       update(dbmMgr, ti_discountpolicy);
/*     */     } catch (ApplicationException e) {
/* 138 */       e.printStackTrace();
/* 139 */       result_code = "1";
/*     */     }
/* 141 */     map.setString("result_code", result_code);
/* 142 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_discountpolicy ti_discountpolicy)
/*     */     throws ApplicationException
/*     */   {
/* 151 */     dbmMgr.update("updateTi_discountpolicy", ti_discountpolicy);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 161 */     Hashtable ti_discountpolicy = (Hashtable)obj;
/* 162 */     if (start == 0)
/* 163 */       start = 0;
/*     */     else {
/* 165 */       start = (start - 1) * limit;
/*     */     }
/* 167 */     ti_discountpolicy.put("start", Integer.valueOf(start));
/* 168 */     ti_discountpolicy.put("limit", Integer.valueOf(limit));
/* 169 */     return this.queryList.getList("getListByTi_discountpolicyPage", ti_discountpolicy);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 180 */     Hashtable ti_discountpolicy = (Hashtable)obj;
/* 181 */     List list = this.queryList.getList("getCountByObjTi_discountpolicy", ti_discountpolicy);
/* 182 */     int count = 0;
/* 183 */     if ((list != null) && (list.size() > 0)) {
/* 184 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 185 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 186 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 189 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 199 */     return this.queryList.getList("getTi_discountpolicyByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getDiscountByPK(String pk) {
/* 203 */     return this.queryList.getList("getTi_discountByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getVoucherInfoByPk(String pk) {
/* 207 */     return this.queryList.getList("getVoucherInfoByPk", pk);
/*     */   }
/*     */ 
/*     */   public int checkDiscountpolicy(String member_level, String type, String spending, String number) {
/* 211 */     Ti_discountpolicy policy = new Ti_discountpolicy();
/* 212 */     policy.setMember_level(Integer.parseInt(member_level));
/* 213 */     policy.setOffer_type(type);
/* 214 */     spending = spending.equals("") ? "0.00" : spending;
/* 215 */     policy.setSpending(spending);
/* 216 */     number = number.equals("") ? "0" : number;
/* 217 */     policy.setNumber(Integer.parseInt(number));
/* 218 */     List list = this.queryList.getList("checkDiscountpolicy", policy);
/* 219 */     int count = 0;
/* 220 */     if ((list != null) && (list.size() > 0)) {
/* 221 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 222 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 223 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 226 */     return count;
/*     */   }
/*     */ 
/*     */   public List getDiscountpolicy(int member_level, String spending, String number) {
/* 230 */     Ti_discountpolicy policy = new Ti_discountpolicy();
/* 231 */     policy.setMember_level(member_level);
/* 232 */     spending = spending.equals("") ? "0.00" : spending;
/* 233 */     policy.setSpending(spending);
/* 234 */     number = number.equals("") ? "0" : number;
/* 235 */     policy.setNumber(Integer.parseInt(number));
/* 236 */     List list = this.queryList.getList("getDiscountpolicy", policy);
/* 237 */     return list;
/*     */   }
/*     */ 
/*     */   public List getOfferTypesByGoodOffer()
/*     */   {
/* 242 */     List bList = this.queryList.getList("getOfferTypesByGoodOffer");
/* 243 */     return bList;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_discountpolicy.Ti_discountpolicyInfo
 * JD-Core Version:    0.6.0
 */